package edu.whut.Test;
/*
需求：
教师、学生类，使用父类属性，使用父类的构造方法
 */
public class test01 {
    public static void main(String[] args) {
        Teacher teacher = new Teacher("陈敲",63);
        Student student = new Student("王地",18,99.2);
        teacher.teach();
        student.study();
    }
}
class People{
    private String name;
    private int age;

    public People() {
    }

    public People(String name, int age) {
        this.name = name;
        this.age = age;
    }

    /**
     * 获取
     * @return name
     */
    public String getName() {
        return name;
    }

    /**
     * 设置
     * @param name
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * 获取
     * @return age
     */
    public int getAge() {
        return age;
    }

    /**
     * 设置
     * @param age
     */
    public void setAge(int age) {
        this.age = age;
    }


}
class Teacher extends People{
    public Teacher(String name, int age) {
      super(name,age);
    }

    public void teach(){
        System.out.println("姓名为"+super.getName() + ",年龄为" + super.getAge() + "的老师正在讲课！");
    }
}
class Student extends People{
    private double score;

    public Student(String name, int age, double score) {
        super(name, age);
        this.score = score;
    }

    public Student() {
    }

    public Student(double score) {
        this.score = score;
    }

    public void study(){
        System.out.println("姓名为"+super.getName() + ",年龄为" + super.getAge() +"成绩为" + score +"的学生正在学习！");
    }

    public double getScore() {
        return score;
    }

    public void setScore(double score) {
        this.score = score;
    }

}
